#include <iostream>

void bubbleSort(int arr[], int len)
{
    for (int i = len - 1; i > 0; i--)
    {
        for (int j = 0; j < i; j++)
        {
            if (arr[j] > arr[j + 1])
            {
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
}

void printArray(int* arr, int len)
{
    using namespace std;
    for (int i = 0; i < len; i++) {
        cout << arr[i] << " "; // 错误写法：cout << arr[i] + " "; // 不能用加号
    }
    cout << endl;
}

int main(int argc, char const *argv[])
{
    int N = 10;
    int arr[N] = {1, 3, 2, 4, 0, 1, 2, 6, 4, 0};
    printArray(arr, N);
    bubbleSort(arr, N);
    printArray(arr, N);
    return 0;
}
